package com.sunyard.manage.service;

import com.sunyard.dal.bo.org.OrganizationAddBO;
import com.sunyard.dal.bo.org.OrganizationDeleteBO;
import com.sunyard.dal.bo.org.OrganizationQueryBO;
import com.sunyard.dal.bo.org.OrganizationUpdateBO;
import com.sunyard.dal.bo.PaginationBO;
import com.sunyard.dal.bo.org.SysPermissionBo;
import com.sunyard.dal.dto.OrgTreeDTO;
import com.sunyard.dal.dto.OrganizationDTO;
import com.sunyard.dal.dto.SysPermissionDTO;
import com.sunyard.dal.entity.Organization;
import com.sunyard.dal.entity.SysLog;
import com.sunyard.utils.Response.BaseResult;
import com.sunyard.utils.manage.DataGrid;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

public interface OrganizationService {

    /**
     * @Description: 条件分页查询机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/16
     */
    BaseResult<DataGrid<OrganizationDTO>> querryOrginazitionByPage(PaginationBO<OrganizationQueryBO> orginazationQuery,
                                                                   HttpServletRequest request) throws Exception;


    /**
     * @Description: 添加机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/18 16:43
     */
    BaseResult insertOrganization(HttpServletRequest request, OrganizationAddBO organizationAddBO,
                                  String orgId, String opId, String opName, List<String> orgList) throws Exception;

    /**
     * @Description: 批量添加机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/18 16:43
     */
    BaseResult insertBatchOrganization(
            OrganizationAddBO organizationAddBO,
            String orgId, String opId, String opName, List<String> orgList, List<SysLog> logList) throws Exception;

    /**
     * @Description: 修改机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/18 20:22
     */
    BaseResult updateOrganization(HttpServletRequest request, OrganizationUpdateBO organizationUpdateBO) throws Exception;

    /**
     * @Description: 删除机构信息
     * @Author: jiy.fang
     * @Date: 2019/7/19 14:07
     */
    BaseResult deleteOrganization(HttpServletRequest request, OrganizationDeleteBO organizationDeleteBO) throws Exception;

    /**
     * @Description: 获取当前机构及所有子机构
     * @Author: jiy.fang
     * @Date: 2019/7/22 22:54
     */
    List<Organization> getOrgIds(String orgId) throws Exception;

    List<String> getOrgIdsByOrgId(String orgId) ;



    /**
     * @Description: 获取本机构上下级ID
     * @Author: huix.Liang
     * @Date: 2019-08-06 16:18
     */
    List<Organization> getAllLevelOrgIds(HttpServletRequest request);

    /**
     * @Description: 机构导出
     * @Author: jiy.fang
     * @Date: 2019/7/22 23:44
     */
    List<OrganizationDTO> getListOrganizationExport(OrganizationQueryBO organizationQueryBO, HttpServletRequest request) throws Exception;

    /**
     * @param orgIdList
     * @param orgId
     * @Description: 根据机构号查询所有上级、下级机构号
     * @Author: huix.Liang
     * @Date: 2019-07-23 10:46
     */
    void getListOrgId(List<String> orgIdList, String orgId, boolean includeParentOrg);


    /**
     * @Description: 根据角色类型获取机构信息
     * @Author: jiy.fang
     * @Date: 2019/8/2 9:56
     */
    List<Organization> getOrgIdsByRoleType(HttpSession session, int roleType) throws Exception;


    /**
     * @Description 获取机构树
     * @Author JIYU
     * @Date 2020/1/16 11:14
     **/
    BaseResult<List<OrgTreeDTO>> obtainOrgTree(String orgId) throws Exception;


    /**
     * @return java.util.List<com.sunyard.dal.entity.Organization>
     * @Author xin.qi
     * @Description 根据用户获取机构列表
     * @Date 2020/3/6 9:45
     * @Param
     */
    List<Organization> getOrganizationIdsByOp(HttpServletRequest request);

    /**
     * @param orgId
     * @return java.util.List<com.sunyard.dal.entity.Organization>
     * @Author xin.qi
     * @Description 根据当前机构获取子机构列表
     * @Date 2020/3/6 14:43
     * @Param
     */
    List<Organization> getChildOrgIds(String orgId);

    /**
     * @description 根据组织机构id查询当前及其下级机构
     * @author tsz
     * @date 2022/12/16
     * @param orgId
     * @return List<String> 
     * @throws 
    */
    List<String> getListOrgIds(String orgId);

    /**
     * @description TODO
     * @author tsz
     * @date 2022/12/16
     * @param request
     * @param sysPermissionBo
     * @return BaseResult 
     * @throws 
    */
    BaseResult configSysPermission(HttpServletRequest request, SysPermissionBo sysPermissionBo);

    /**
     * @description 批量删除组织机构
     * @author tsz
     * @date 2022/12/16
     * @param request
     * @param organizationDeleteBO
     * @return BaseResult 
     * @throws Exception
    */
    BaseResult batchDeleteOrg(HttpServletRequest request, OrganizationDeleteBO organizationDeleteBO) throws Exception;

    /**
     * @description 获取组织机构树
     * @author tsz
     * @date 2022/12/16
     * @param
     * @return BaseResult<List<OrgTreeDTO>>
     * @throws
    */
    BaseResult<List<OrgTreeDTO>> getAllOrgTree();

    /**
     * @description 查询机构审核类型
     * @author tsz
     * @date 2022/12/16
     * @param request
     * @return BaseResult<SysPermissionDTO> 
     * @throws 
    */
    BaseResult<SysPermissionDTO> querySysPermission(HttpServletRequest request);

}

